pp108 : Creating a Sub-Component

Creating a Sub-Component

This topic describes the procedure of creating a sub-component for the managed components.

The sub-components to the existing managed components can be created wherever it is necessary.
For example, the Ws-AppServer application connector internally uses a DBConnectionPool object that handles database connection pooling. In this scenario, a sub-component can be added to the managed component of the Ws-AppServer application connector. The DBConnectionPool can define settings, operations and so on, on this sub-component.
In this case, the component associated with the DBConnectionPool is called a sub-component of the application connector (the parent component).

Note :
Sub-components can be created dynamically too. When creating a sub-component after the component tree has been registered through registerComponentTree(), such components do not become visible automatically. In such a case, registerComponentTree() must be explicitly called after dynamically adding the sub-component.

This is illustrated in the following sample:

// Dynamically create a subcomponent of s_managedComponent
IManagedComponent webAppManagedComponent = webApplication.createManagedComponent(s_managedComponent);

// Explicitly register the newly created component (tree)
webAppManagedComponent.registerComponentTree();

s_webApplications.put(className, webApplication);